Specification of the gnu Smalltalk virtual machine
نویسنده
چکیده
This document exposes the virtual machine’s architecture with respect to bytecode execution, and documents how the methods are stored as objects in memory. The first part of the specification details a subset of the reflection classes that the virtual machine accesses in order to execute the code. The second part details the bytecode set and the invariants that should hold for a method to be valid. This is a low-level specification. A formalization of the Smalltalk language semantics, on which the virtual machine is based, can be found in [Wol87]. 1 Structure of instances of CompiledCode Instances of CompiledCode can have byte-sized indexed instance variables which store the bytecodes; in addition, they have three named instance variables: • literals is an Array that holds the constants and references to globals that are referenced in the code (the method’s literal pool). • flags is a SmallInteger that stores miscellaneous information about the method (number of locals and arguments, stack size, and so on). CompiledCode has two concrete subclasses, CompiledMethod and CompiledBlock. These two classes match the two fundamental constructs for organizing program flow in the Smalltalk language—methods and blocks. Logically, methods represent actions made on an object, or in general requests to an object: by defining a method, an object exposes a contract that hides implementation details; blocks, instead, are objects that access a series of statements, and they can be passed around or stored in an instance variable. For example, the following code myList collect: [ :x | x + 1 ]. uses blocks like this Lisp lambda function: (mapcar (lambda (x) (+ 1 x)) *my-list*) From this example, one can see that methods like collect: live inside a class (the class of myList) and can be invoked through their name; instead a block is anonymous.
منابع مشابه
Smalltalk: Overview and Implementation Issues
In respect to points 1-3, Smalltalk is similar to recently developed object-oriented languages such as Java or C#. However, it includes a GUI which contains a development environment and debugging facilities; even the GUI itself can be modified and analyzed using Smalltalk. Smalltalk implementations include the virtual machine (VM) and the virtual image (VI). The virtual machine is hardware/ope...
متن کاملBiskit - A software platform for structural bioinformatics
UNLABELLED Biskit is a modular, object-oriented python library that provides intuitive classes for many typical tasks of structural bioinformatics research. It facilitates the manipulation and analysis of macromolecular structures, protein complexes and molecular dynamics trajectories. At the same time, Biskit offers a software platform for the rapid integration of external programs and new alg...
متن کاملFlexible Language Interoperability
Virtual machines raise the abstraction level of the execution environment at the cost of restricting the set of supported languages. Moreover, the ability of a language implementation to integrate with other languages hosted on the same virtual machine typically constrains the features of the language. In this paper, we present a highly flexible yet efficient approach to hosting multiple progra...
متن کاملInter-language Collaboration in an Object-oriented Virtual Machine
Multi-language virtual machines have a number of advantages. They allow software developers to use software libraries that were written for different programming languages. Furthermore, language implementors do not have to bother with low-level VM functionality and their implementation can benefit from optimizations in existing virtual machines. MagLev is an implementation of the Ruby programmi...
متن کاملBack to the future: the story of Squeak, a practical Smalltalk written in itself
Squeak is an open, highly-portable Smalltalk implementation whose virtual machine is written entirely in Smalltalk, making it easy to debug, analyze, and change. To achieve practical performance, a translator produces an equivalent C program whose performance is comparable to commercial Smalltalks. Other noteworthy aspects of Squeak include: a compact object format that typically requires only ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2008